package com.grass.p019lv.adapter;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.bean.RelateVideoBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.utils.TimeUtils;
import com.androidx.p013lv.base.utils.UiUtils;

/* renamed from: com.grass.lv.adapter.RelatedWorksAdapter */
public class RelatedWorksAdapter extends BaseRecyclerAdapter<RelateVideoBean.DataBean, Holder> {
    private String domain;

    public void setDomain(String str) {
        this.domain = str;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((RelateVideoBean.DataBean) getDataInPosition(i));
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_related_works, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.grass.lv.adapter.RelatedWorksAdapter$Holder */
    public class Holder extends BaseRecyclerHolder {
        ImageView iv_cover;
        ImageView iv_original = ((ImageView) this.itemView.findViewById(R.id.iv_original));
        ImageView iv_pay = ((ImageView) this.itemView.findViewById(R.id.iv_pay));
        ImageView iv_vip = ((ImageView) this.itemView.findViewById(R.id.iv_vip));
        ImageView iv_xm = ((ImageView) this.itemView.findViewById(R.id.iv_xm));
        TextView tv_score;
        TextView tv_subtitle;
        TextView tv_times;
        TextView tv_title;

        Holder(View view) {
            super(view);
            this.iv_cover = (ImageView) view.findViewById(R.id.iv_cover);
            this.tv_times = (TextView) view.findViewById(R.id.tv_times);
            this.tv_score = (TextView) view.findViewById(R.id.tv_score);
            this.tv_title = (TextView) view.findViewById(R.id.tv_title);
            this.tv_subtitle = (TextView) view.findViewById(R.id.tv_subtitle);
        }

        /* access modifiers changed from: package-private */
        public void setData(RelateVideoBean.DataBean dataBean) {
            if (dataBean.getCoverImg() == null || dataBean.getCoverImg().size() <= 0 || TextUtils.isEmpty(dataBean.getCoverImg().get(0))) {
                GlideUtils.loadCropRadiusDefault(4, this.iv_cover);
            } else {
                GlideUtils.loadCropRadius(RelatedWorksAdapter.this.domain + dataBean.getCoverImg().get(0), 4, this.iv_cover);
            }
            this.tv_title.setText(dataBean.getTitle());
            this.tv_subtitle.setVisibility(8);
            TextView textView = this.tv_score;
            textView.setText(UiUtils.num2str(dataBean.getFakeWatchNum()) + "");
            this.tv_times.setText(TimeUtils.stringForTime((long) (dataBean.getPlayTime() * 1000)));
            this.iv_vip.setVisibility(8);
            this.iv_pay.setVisibility(8);
            this.iv_xm.setVisibility(8);
            if (dataBean.getVideoType() == 1) {
                this.iv_vip.setVisibility(0);
            } else if (dataBean.getVideoType() == 2) {
                this.iv_pay.setVisibility(0);
            } else if (dataBean.getVideoType() == 0) {
                this.iv_xm.setVisibility(0);
            }
            if (dataBean.isSelfMade()) {
                this.iv_original.setVisibility(0);
            } else {
                this.iv_original.setVisibility(8);
            }
        }
    }
}
